package com.my.study.util;

import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;

public class TestUtil {

    /**
     * 本地调试
     *
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        SecretKeySpec secretKeySpec = new SecretKeySpec("www.testTest.com".getBytes(), "AES");
        Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
        cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);

        System.out.println("用户:"+ Base64.getEncoder().encodeToString(cipher.doFinal(Base64.getEncoder().encode("test".getBytes()))));
        System.out.println("密码:"+Base64.getEncoder().encodeToString(cipher.doFinal(Base64.getEncoder().encode("test001".getBytes()))));
    }
}
